import { EntitySchema } from '@mikro-orm/core';

export class LeAccount {
  id!: string;
  mobile?: string;
  password?: string;
  nickname?: string;
  roles?: string;
  format?: unknown;
  status?: boolean = false;
  isDeleted?: boolean = false;
  createdTime?: string;
  updatedTime?: string;
  deletedTime?: string;
  avatar?: string;
  name?: string;
  type: boolean = true;
  remark!: string;
  form?: string;
}

export const LeAccountSchema = new EntitySchema({
  class: LeAccount,
  properties: {
    id: { primary: true, type: 'string', columnType: 'bigint' },
    mobile: { type: 'string', columnType: 'bigint', nullable: true },
    password: { type: 'string', length: 128, nullable: true },
    nickname: { type: 'string', length: 20, nullable: true },
    roles: { type: 'string', length: 100, nullable: true },
    format: { type: 'unknown', columnType: 'longtext', nullable: true },
    status: { type: 'boolean', nullable: true, default: false },
    isDeleted: { type: 'boolean', nullable: true, default: false },
    createdTime: { type: 'string', columnType: 'bigint', nullable: true },
    updatedTime: { type: 'string', columnType: 'bigint', nullable: true },
    deletedTime: { type: 'string', columnType: 'bigint', nullable: true },
    avatar: { type: 'string', length: 255, nullable: true },
    name: { type: 'string', length: 50, nullable: true },
    type: { type: 'boolean', default: true },
    remark: { type: 'string', length: 255 },
    form: { type: 'string', columnType: 'text', nullable: true },
  },
});
